package com.haihui.platform.entity;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by HaiHui on 2017/10/16.
 */
public class PagingBean {
    public static final String PAGING_BEAN = "_paging_bean";
    public static final Integer DEFAULT_PAGE_SIZE = Integer.valueOf(25);
    public static final int SHOW_PAGES = 6;

    public static String getPagingBean() {
        return PAGING_BEAN;
    }

    public Integer getStart() {
        return start;
    }

    public void setStart(Integer start) {
        this.start = start;
    }

    public static int getShowPages() {
        return SHOW_PAGES;
    }

    public static Integer getDefaultPageSize() {
        return DEFAULT_PAGE_SIZE;
    }

    public Integer start;
    public Integer end;
    private Integer pageSize;

    public Integer getEnd() {
        return end;
    }

    public void setEnd(Integer end) {
        this.end = end;
    }
    public PagingBean(int start, int limit) {
        this.pageSize = Integer.valueOf(limit);
        this.start = Integer.valueOf(start);

        if(this.start.intValue() != 0 && this.start.intValue() != 1) {
            this.start = Integer.valueOf(this.pageSize.intValue() * (this.start.intValue() - 1));

        } else {
            //this.pageMap.put("start", Integer.valueOf(0));
            this.start =  Integer.valueOf(0);

        }
        this.end = this.pageSize;

    }
}
